package com.bingxue.edu.common.enums;

import com.bingxue.edu.framework.enums.Dict;
import com.bingxue.edu.framework.enums.DictEnum;
import com.fasterxml.jackson.annotation.JsonValue;
import com.mybatisflex.annotation.EnumValue;
import lombok.Getter;
import lombok.RequiredArgsConstructor;

/**
 * 数据状态枚举
 *
 * @author panbo
 * @since 2024/6/27
 */
@Getter
@RequiredArgsConstructor
@Dict("数据状态")
public enum CommonStatusEnum implements DictEnum<Integer> {

    ENABLED(1, "启用"),
    DISABLED(0, "禁用"),;

    @JsonValue
    @EnumValue
    private final Integer value;
    private final String label;

    public static CommonStatusEnum of(Boolean enabled) {
        return enabled ? ENABLED: DISABLED;
    }
}
